package com.aidex.biz.service.impl;

import com.aidex.biz.domain.CustomerShadowInfo;
import com.aidex.biz.mapper.CustomerShadowInfoMapper;
import com.aidex.biz.service.CustomerShadowInfoService;
import com.aidex.common.annotation.DataScope;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.common.utils.NumberUtils;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 客户跟踪Service业务层处理
 *
 * @author sean
 * @email 2074844820@qq.com
 * @date 2022-08-06
 */
@Service
@Transactional(readOnly = true)
public class CustomerShadowInfoServiceImpl extends BaseServiceImpl<CustomerShadowInfoMapper, CustomerShadowInfo> implements CustomerShadowInfoService {
    private static final Logger log = LoggerFactory.getLogger(CustomerShadowInfoServiceImpl.class);

    /**
     * 获取单条数据
     *
     * @param customerShadowInfo 客户跟踪
     * @return 客户跟踪
     */
    @Override
    public CustomerShadowInfo get(CustomerShadowInfo customerShadowInfo) {
        CustomerShadowInfo dto = super.get(customerShadowInfo);
        return dto;
    }

    /**
     * 获取单条数据
     *
     * @param id 客户跟踪id
     * @return 客户跟踪
     */
    @Override
    public CustomerShadowInfo get(String id) {
        CustomerShadowInfo dto = super.get(id);
        return dto;
    }


    /**
     * 查询客户跟踪列表
     *
     * @param customerShadowInfo 客户跟踪
     * @return 客户跟踪
     */
    @Override
    @DataScope(userAlias = "a", deptAlias = "a")
    public List<CustomerShadowInfo> findList(CustomerShadowInfo customerShadowInfo) {
        return super.findList(customerShadowInfo);
    }

    /**
     * 分页查询客户跟踪列表
     *
     * @param customerShadowInfo 客户跟踪
     * @return 客户跟踪
     */
    @Override
    @DataScope(userAlias = "a", deptAlias = "a")
    public PageInfo<CustomerShadowInfo> findPage(CustomerShadowInfo customerShadowInfo) {
        return super.findPage(customerShadowInfo);
    }

    /**
     * 保存客户跟踪
     *
     * @param customerShadowInfo
     * @return 结果
     */
    @Override
    public boolean save(CustomerShadowInfo customerShadowInfo) {
        return super.save(customerShadowInfo);
    }


    /**
     * 删除客户跟踪信息
     *
     * @param customerShadowInfo
     * @return 结果
     */
    @Override
    public boolean remove(CustomerShadowInfo customerShadowInfo) {
        return super.remove(customerShadowInfo);
    }

    /**
     * 批量删除客户跟踪
     *
     * @param ids 需要删除的客户跟踪ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteCustomerShadowInfoByIds(String[] ids) {
        return mapper.deleteCustomerShadowInfoByIds(ids);
    }

    /**
     * 获取最大编号
     *
     * @param customerShadowInfo 客户跟踪
     * @return 结果
     */
    @Override
    public int findMaxSort(CustomerShadowInfo customerShadowInfo) {
        return NumberUtils.nextOrder(mapper.findMaxSort(customerShadowInfo));
    }
}
